using System;
using System.Data;
using System.Collections;

namespace RMAS.DAL
{
    /// <summary>
    /// Summary description for DM_BRANCH.
    /// </summary>
    public class DM_BRANCHList : CollectionBase
    {
		private string _ErrMsg;
        public string ErrMsg { get { return _ErrMsg; } }
    	public DM_BRANCHList()
    	{
	    }

		public void Add(DM_BRANCH entity)
		{
            this.List.Add(entity);
		}

		public void Add(DM_BRANCHList list)
		{	
			foreach(DM_BRANCH entity in list)
			{
				this.Add(entity);
			}
		}
	
		public new virtual Enumerator GetEnumerator()
		{
		    return new Enumerator(this);
		}
		public virtual DM_BRANCH this[int index]
		{
		    get
			{
				return (DM_BRANCH)this.List[index];
			}
			set
			{
				this.List[index] = value;
			}
		}

		#region Find Object And List Object
		//---PrimaryKey
	public virtual DM_BRANCH Find(string ID)
	{
	    foreach (DM_BRANCH obj in this.List)
	    {
		if(obj.ID.ToString().ToUpper().Trim() == ID.ToString().ToUpper().Trim())
		{
		    obj.IsExisting = true;
		    return obj;
		}
	    }
	    return null;
	}

public virtual DM_BRANCHList FindListByID(string ID)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
		    if(obj.ID.ToString().ToUpper().Trim() == ID.ToString().ToUpper().Trim())
		    {
				List.Add(obj);
		    }
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
    	{
		_ErrMsg = ex.Message;
        		return null;
    	}
}
		//---NonPrimaryKey
        public virtual DM_BRANCH FindByIDPOS(Int32 IDPOS)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.IDPOS.ToString().ToUpper().Trim() == IDPOS.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByBranch_Name(string Branch_Name)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.Branch_Name.ToString().ToUpper().Trim() == Branch_Name.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByBranch_Address(string Branch_Address)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.Branch_Address.ToString().ToUpper().Trim() == Branch_Address.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByBranch_Phone(string Branch_Phone)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.Branch_Phone.ToString().ToUpper().Trim() == Branch_Phone.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByBranch_Fax(string Branch_Fax)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.Branch_Fax.ToString().ToUpper().Trim() == Branch_Fax.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByBranch_Email(string Branch_Email)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.Branch_Email.ToString().ToUpper().Trim() == Branch_Email.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByBranch_Note(string Branch_Note)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.Branch_Note.ToString().ToUpper().Trim() == Branch_Note.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByBranch_Logo(byte[] Branch_Logo)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.Branch_Logo.ToString().ToUpper().Trim() == Branch_Logo.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByBranch_Image(byte[] Branch_Image)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.Branch_Image.ToString().ToUpper().Trim() == Branch_Image.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByBranch_Director(string Branch_Director)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.Branch_Director.ToString().ToUpper().Trim() == Branch_Director.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByBranch_Revenue(decimal Branch_Revenue)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.Branch_Revenue.ToString().ToUpper().Trim() == Branch_Revenue.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByBranch_Facebook(string Branch_Facebook)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.Branch_Facebook.ToString().ToUpper().Trim() == Branch_Facebook.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByDateTimeBeginLicence(DateTime DateTimeBeginLicence)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.DateTimeBeginLicence.ToString().ToUpper().Trim() == DateTimeBeginLicence.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByDateTimeEndLicence(DateTime DateTimeEndLicence)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.DateTimeEndLicence.ToString().ToUpper().Trim() == DateTimeEndLicence.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByHasLicenceKey(bool HasLicenceKey)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.HasLicenceKey.ToString().ToUpper().Trim() == HasLicenceKey.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByVersion(string Version)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.Version.ToString().ToUpper().Trim() == Version.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual DM_BRANCH FindByIsUse(bool IsUse)
        {
	        foreach (DM_BRANCH obj in this.List)
	        {
		        if(obj.IsUse.ToString().ToUpper().Trim() == IsUse.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

public virtual DM_BRANCHList FindListByIDPOS(Int32 IDPOS)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.IDPOS.ToString().ToUpper().Trim() == IDPOS.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByBranch_Name(string Branch_Name)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.Branch_Name.ToString().ToUpper().Trim() == Branch_Name.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByBranch_Address(string Branch_Address)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.Branch_Address.ToString().ToUpper().Trim() == Branch_Address.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByBranch_Phone(string Branch_Phone)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.Branch_Phone.ToString().ToUpper().Trim() == Branch_Phone.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByBranch_Fax(string Branch_Fax)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.Branch_Fax.ToString().ToUpper().Trim() == Branch_Fax.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByBranch_Email(string Branch_Email)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.Branch_Email.ToString().ToUpper().Trim() == Branch_Email.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByBranch_Note(string Branch_Note)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.Branch_Note.ToString().ToUpper().Trim() == Branch_Note.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByBranch_Logo(byte[] Branch_Logo)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.Branch_Logo.ToString().ToUpper().Trim() == Branch_Logo.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByBranch_Image(byte[] Branch_Image)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.Branch_Image.ToString().ToUpper().Trim() == Branch_Image.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByBranch_Director(string Branch_Director)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.Branch_Director.ToString().ToUpper().Trim() == Branch_Director.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByBranch_Revenue(decimal Branch_Revenue)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.Branch_Revenue.ToString().ToUpper().Trim() == Branch_Revenue.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByBranch_Facebook(string Branch_Facebook)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.Branch_Facebook.ToString().ToUpper().Trim() == Branch_Facebook.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByDateTimeBeginLicence(DateTime DateTimeBeginLicence)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.DateTimeBeginLicence.ToString().ToUpper().Trim() == DateTimeBeginLicence.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByDateTimeEndLicence(DateTime DateTimeEndLicence)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.DateTimeEndLicence.ToString().ToUpper().Trim() == DateTimeEndLicence.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByHasLicenceKey(bool HasLicenceKey)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.HasLicenceKey.ToString().ToUpper().Trim() == HasLicenceKey.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByVersion(string Version)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.Version.ToString().ToUpper().Trim() == Version.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual DM_BRANCHList FindListByIsUse(bool IsUse)
{
	try
	{
		DM_BRANCHList List = new DM_BRANCHList();
		foreach (DM_BRANCH obj in this.List)
		{
			if(obj.IsUse.ToString().ToUpper().Trim() == IsUse.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}
		#endregion
     
		#region Inner Classes
		/// <summary>
		/// Type-specific enumeration class, used by LogCollection.GetEnumerator.
		/// </summary>
		public class Enumerator : IEnumerator
		{
			private IEnumerator wrapped;

			public Enumerator(DM_BRANCHList collection)
			{
				this.wrapped = ((CollectionBase)collection).GetEnumerator();
			}

			public DM_BRANCH Current
			{
				get
				{
					return (DM_BRANCH)(this.wrapped.Current);
				}
			}

			object IEnumerator.Current
			{
				get
				{
					return (DM_BRANCH)(this.wrapped.Current);
				}
			}

			public bool MoveNext()
			{
				return this.wrapped.MoveNext();
			}

			public void Reset()
			{
				this.wrapped.Reset();
			}
      }
      #endregion  
   }
}